//
//  HLIMKitSessionTimeCell.m
//  YueYue
//
//  Created by hulu001 on 2024/1/12.
//

#import "HLIMKitSessionTimeCell.h"
#import "HLChatKit.h"
#import "HLIMKitTimeModel.h"

@interface HLIMKitSessionTimeCell ()

@property (nonatomic,strong) HLIMKitTimeModel *model;

@end


@implementation HLIMKitSessionTimeCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = UIColor.clearColor;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        _timeBGView = [[UIImageView alloc] initWithFrame:CGRectZero];
        [self addSubview:_timeBGView];
        _timeLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        _timeLabel.font = [UIFont systemFontOfSize:12];
        _timeLabel.textColor = [UIColor colorWithRed:144/255.0 green:144/255.0 blue:144/255.0 alpha:1.0];
        [self addSubview:_timeLabel];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    [_timeLabel sizeToFit];
    _timeLabel.center = CGPointMake(self.middleX, self.middleY);
}


- (void)refreshData:(HLIMKitTimeModel *)data
{
    self.model = data;
    if([self checkData]){
        HLIMKitTimeModel *model = data;
        _timeLabel.text = [HLHelper showTime:model.messageTime showDetail:YES];
    }
}

- (BOOL)checkData{
    return [self.model isKindOfClass:[HLIMKitTimeModel class]];
}

@end
